GBML manual / Audio

sound_playing

True if this sound is currently playing.

Syntax

sound_playing(s) -> bool

Arguments

NameType
ssound

Returns

bool

Description

True if this sound is currently playing. Mostly useful to avoid re-triggering a long effect that is already running (a charge-up loop that should only start once, not restart on every frame the trigger is held).

Example

if (!sound_playing(snd_doc_beep)) {
    sound_play(snd_doc_beep, 1);
}

Starts the sound only if it is not already playing - safe to call every frame without ever restarting or overlapping it with itself.

See also: sound_play